﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NGUYENDUYKHANH.OOP.Triangle
{
  public class CalTriangle
    {
      //global datafield
        double side1 = 1.0;
        double side2 = 1.0;
        double side3 = 1.0;
     
        public CalTriangle()
        {
        }

        public CalTriangle(double _side1, double _side2, double _side3)
        {
            side1 = _side1;
            side2 = _side2;
            side3 = _side3;
        }

       
        public double Area()
        {
           double p = (side1 + side2 + side3) / 2;
           return Math.Sqrt(p * (p - side1) * (p - side2) * (p - side3));
        }

        public double Perimeter()
        {
            return side1 + side2 + side3;
        }

        public string toString()
        {
            return "Triangle: side1 = " + side1 + "side 2= " + side2 + " side3 = " + side3;
        }
      
    }
}
